Backing up Your Magento via Shell / SSH

In this article, we will show you how to back up your magento files and database via Shell/SSH. It is highly recommended that you make regular backups of your Magento site so you can easily restore it if something unexpected happens.

To take a backup of your site, you need to back up both your Magento files and Magento database.

Note: For security reasons, only the accounts have passed our verification will be granted permission to the Shell / SSH service. If you would like to enable it, please update your billing information. Our staff will finish verifying your information within 2 hours.

1. Locate target application

Log in to the Control Panel and locate your target deployment on the Home page or the My Applications page.

2.Go to the Shell / SSH page

Go to the Shell / SSH page by clicking the "Manage" button on the Home page or the My Applications page.

3. Launch a shell session

Click the “Connect” icon on the Shell / SSH page to launch the command-line interface.

For security reasons, only the accounts have passed our verification will be granted permission to the Shell / SSH service. If you would like to enable it, please update your billing information. Our staff will finish verifying your information within 2 hours.

4. Back up your Magento

Back up the database using mysqldump

The database name for magento is magentodatabase. Execute the command as below to back up your magento database.

mysqldump -uroot -p$MYSQL_ROOT_PASSWORD magentodatabase >/cloudclusters/magento/magentodatabase.sql

Back up Magento files

Execute the commands as below to back up your magento files (/cloudclusters/magento). cd /cloudclusters/ && ll

tar zcvf magento.tar.tgz /cloudclusters/magento

It will take several minutes to compress the magento files.

Once you have compressed your magento files, move the compressed file to the directory /cloudclusters/magento by executing the command as below.

mv magento.tar.tgz /cloudclusters/magento

5. Download your magento backup via browser

The download URL will be your magento domain name or default domain name plus the compressed file name.

For example: https://magento-xxxxx-0.cloudclusters.net/magento.tar.tgz

Now open your browser and enter the URL to download your magento backup.

6. Remove the backup file

Once you have downloaded your backup to your local machine, you can remove the backup file from the Magento Server.

Execute the commands as below in the SSH session to remove your backup files:

rm /cloudclusters/magento/magento.tar.tgz

rm /cloudclusters/magento/magentodatabase.sql

Copyright © 2021 Cloud Clusters Inc.Revised on 12/25/2020

results matching ""

    No results matching ""